

$(".touxiang").on('click', function () {
    mesAjax();
})


let url = window.location.href;
let mes = url.slice(url.indexOf("?") + 1);



document.querySelector('.btncu').addEventListener('click', function () {
    let telP = document.querySelector('.tel').innerHTML;
    let nameAm = document.querySelector('.names').value;
    let genderAm1 = ""
    document.querySelectorAll(".gender1").forEach(v => {
        if ($(v['checked'])[0]) {
            let gender = v.getAttribute('gender');
            genderAm1 = gender;
        }
    })
    document.querySelector(".outer").style.display = 'none';
    document.querySelector(".master").style.display = 'none';

    amdens(telP, nameAm, genderAm1);
    // console.log(genderAm1, nameAm)

})
document.querySelector('.off').addEventListener('click', function () {
    document.querySelector(".outer").style.display = 'none';
    document.querySelector(".master").style.display = 'none';
})
let amdens = async (telP, nameAm, genderAm1) => {
    let result = await ajax({
        type: 'POST',
        url: 'http://127.0.0.1:4000/amend/updateStudent',
        data: {
            phone: telP,
            name: nameAm,
            gender: genderAm1
        }
    })
    mesAjax();
    alert('修改成功');
    window.location.href = 'login.html'
    // console.log(result);
}